package day_2022_9_to_12.Day;

/**
 * @author haomin
 * @date 2022/10/18 22:24
 **/
public class Day46_5_Num263_IsUgly {
    class Solution {
        public boolean isUgly(int n) {
            if(n < 1) return false;
            while(n % 2 == 0){
                n /= 2;
            }
            while(n % 3 == 0){
                n /= 3;
            }
            while(n % 5 == 0){
                n /= 5;
            }
            return n == 1;
        }
    }
}